<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        #contentDiv{
            width: 80%;
            height: 300px;
            border: 1px solid #000000;
            margin: auto;
            background-image: url("../img/3.jpg");/*设置背景图片的URL路径*/
            background-size: 300px 300px; /*设置背景图片大小*/
            background-repeat: no-repeat; /*设置平铺方式*/
            background-position: 100px 50px; /*设置背景图片起始位置*/
        }

        #imgDiv{
            width: 300px;
            height: 250px;
            border: 1px solid #000;
            background-image: url("../img/ms.jpg");
        }
        #imgDiv:hover{
            background-position: 0px -250px;
        }
    </style>
</head>
<body>
    <div id="contentDiv"></div>

    <div id="imgDiv"></div>
</body>
</html>